package com.simon.october.cloud.user.controller;

import com.simon.october.cloud.user.config.ServerConfig;
import com.simon.october.cloud.user.entiy.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class Index {

    @Autowired
    ServerConfig serverConfig;

    @GetMapping("/home")
    public String index() {
        return serverConfig.getServerPort()+"  hello!";
    }

    @GetMapping("/home2")
    public String home2(@RequestHeader String name, @RequestHeader String cc) {

        return name+" "+cc;
    }

    @PostMapping("/home3")
    public User home3(@RequestBody User user) {
        return user;
    }

    @GetMapping("/home4")
    public String home4(@RequestParam String name) {
        return "@RequestParam name="+name;
    }
}
